////////////////////////////////////////////////////////////////////////
// Copyright(c) 1999-2016, All Rights Reserved
// Author:	FU YAN
// Created:2016/01/05
// Describe:
////////////////////////////////////////////////////////////////////////
#include "TestServer.h"
#include <stdio.h>

void CTestServer::OnSocketRecv(SOCKET_ID idPeer, char* pMsg, ssize_t nMsgSize)
{
	printf("Recv %lld bytes from %s\n", nMsgSize, m_mapConns[idPeer].strIP.c_str());
}

void CTestServer::OnSocketSendSucc(SOCKET_ID idPeer)
{

}

void CTestServer::OnSocketSendFailed(SOCKET_ID idPeer)
{

}

void CTestServer::OnSocketClose()
{
	printf("Server socekt closed.\n");
}

void CTestServer::OnPeerConnectSucc(UVConnectionInfo_t& stInfo)
{
	m_mapConns[stInfo.idSocket] = stInfo;
	printf("Peer [%s] Connect Succ.\n", stInfo.strIP.c_str());
}

void CTestServer::OnPeerClose(SOCKET_ID idPeer)
{
	printf("Peer [%s] Closed.\n", m_mapConns[idPeer].strIP.c_str());
	m_mapConns.erase(idPeer);
}
